var express = require('express');
var router = express.Router();
var app = require('../app.js');
router.get('/', function(req, res, next) {
    res.render('index', { title: '兴盛数据大屏' });
});

router.get('/mobile', function (req, res, next) {
    const agentSupports = [
        "data-screen-client-ios",
        "data-screen-client-android"
    ];
    // if(agentSupports.indexOf(req.headers["xsyx-app-agent"])>=0){
    if(true){
        res.render('index_mobile', { title: '兴盛数据大屏' });
    }else{
        res.render('permission', { title: '无权访问' })
    }
});

router.get('/permission', function (req, res, next) {
    const sid = req.headers['xsyx-device-id'];
    if(req.headers['xsyx-device-id']){
        res.render('permission', { title: '无权访问', sid  });
    }else{
        res.render('permission', { title: '无权访问' });
    }
});
module.exports = router;
